<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%     
	String path = request.getContextPath();     
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";     
%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>修改新闻</title>
    <base href="<%=basePath%>"/>
    <%@ include file="../../cuv_include.jsp"%>
    <style type="text/css">
  		fieldset,legend,form,table,tr,td,textarea{margin:0;padding:0}
  		form label {font-weight:bold;}
    	table{margin:10px 10px};
  		td{line-height: 40px;}
		input[type="text"]{width:250px;}
		input[type="password"]{width:250px;}
		input[type="textarea"]{width:250px;}   		
    </style>
    <script type="text/javascript" src="ckeditor/ckeditor.js"></script> 
	<script type="text/javascript">
	  $(document).ready(function(){
	        var options = {dataType: 'json', beforeSubmit: beforeSubmit, success: process};
	        $("#itemForm").submit(function(){
	        	$('#content').val(CKEDITOR.instances.content.getData());
	            $(this).ajaxSubmit(options);
	            return false;
	        });
	  });
	  
      function beforeSubmit() {
// 	      if(isEmpty($("#value").val())) { alert("字典值不能为空！"); return false; }
// 	      if(!validateSize($("#value").val(), 1, 20)) { alert("字典值不符合规格！"); return false; } 

          return true;
      }

    function process(responseJson) {
      if(responseJson.code == 0) {
          $('#error_label').text("错误信息：" + responseJson.message);
          $("#p_error").show();
          return;
      }
      var qs = $("#qs").val();
      location.href = "<%=basePath%>comprehensive/news/list.do?" + qs;
    }	  
	</script>    
  </head>
  
  <body>
  <div>
    <fieldset>
      <legend>修改新闻：</legend>
      <form id="itemForm" method="post" action="comprehensive/news/edit.do">
        <input id="qs" name="qs" type="hidden" value="${qs}"/>
        <input type="hidden" name="id" value="${news.id}" />
        <input type="hidden" name="title" value="${news.title}" />
        <input type="hidden" name="createTime" value="${news.createTime}" />
        <input type="hidden" name="createUser" id="createUser" value="${news.createUser }" />
        <p id = "p_error" style = "margin:10px 10px;">
            <label id="error_label" style="color:red;"></label>
        </p>
        <table>
           <tr>
            <td><label for="title">标题：</label></td>
            <td>
            	<input type="text" name="title" id="title" disabled="disabled" value="${news.title }" />
            	<font color="red">&nbsp;*&nbsp;&nbsp;</font>
            	<label for="title">0～200位</label>
            </td>
          </tr> 
          <tr>
            <td><label>显示模式：</label></td>
            <td>
                <select id="showType" name="showType" style="width:250px;">
                  <option value="1" <c:if test="${news.showType == 1}">selected="selected"</c:if> >普通显示</option>
                  <option value="2" <c:if test="${news.showType == 2}">selected="selected"</c:if>>弹窗显示</option>
                </select> 
            </td>
          </tr>            
          <tr>
            <td valign="top"><label for="content">内容：</label></td>
            <td valign="top"><textarea name="content" id="content" cols="60" rows="10"><c:out value="${news.content }"/></textarea>
            	<script type="text/javascript"> 
							    CKEDITOR.replace(
										"content",
										{
											skin:"moono",
											toolbarCanCollapse:false,
											//toolbarStartExpanded:false,
											toolbar:[["Font","FontSize","TextColor","BGColor","-","Bold","Italic","Underline","-","JustifyLeft","JustifyCenter","JustifyRight","-","NumberedList","BulletedList","Table","SpecialChar","PageBreak","Indent",'Outdent']],
												width:"628",
												height:"200",
												colorButton_enableMore:false,
												fontSize_sizes:"12/12px;14/14px;16/16px;18/18px;24/24px",
												font_names:"宋体/宋体,Arial, Helvetica, sans-serif;黑体/黑体,Arial, Helvetica, sans-serif;楷体/楷体, 楷体_GB2312,Arial, Helvetica, sans-serif;",
												pasteFromWordRemoveFontStyles:false,
												pasteFromWordRemoveStyles:false
										});
							    </script>
            	<font color="red">&nbsp;*&nbsp;&nbsp;</font></td>
          </tr>                   
          <tr>
            <td></td>
            <td>
            	<input type="submit" id="btn_insert" value="提交" style="width:80px;" />
            	<input type="button" id="btn_back" value="返回" onclick="history.back();" style="width:80px;" />
            </td>
          </tr>
        </table>
      </form>
    </fieldset>
  </div>    
  </body>
</html>